/*********************************************************************************
  *FileName:  nsuc16xx_lin.c
  *Version:  V1.0
  *Date: 2023-04-16
****************************************Includes***********************************/
#include "nsuc16xx_lin.h"


/***************************************Variables***********************************/



/***************************************Functions***********************************/
void LIN_Init(LINPORT_TypeDef* LINPORTx, LIN_InitTypeDef* LIN_InitStruct)
{
    LINPORTx->CR_b.RXEN = LIN_InitStruct->LIN_RX_Status;
    LINPORTx->CR_b.LOM = LIN_InitStruct->LIN_UV_AutoShuntDown;
    LINPORTx->CR_b.DOMTOEN = LIN_InitStruct->LIN_TX_TimeOut;
    LINPORTx->CR_b.SR = LIN_InitStruct->LIN_SlewRate;
    LINPORTx->CR_b.TXOS = LIN_InitStruct->LIN_TX_OutSource;  
    LINPORTx->CR_b.PAIS = LIN_InitStruct->PWMIO_Source;  
    LINPORTx->CR_b.LAIS = LIN_InitStruct->UART_Source;   
    LINPORTx->CR_b.OCFT = LIN_InitStruct->LIN_OCFitlerTime;
    LINPORTx->CR_b.RXFT = LIN_InitStruct->LIN_RX_FitlerTime;  
	LINPORTx->BSMCR_b.SWPU = LIN_InitStruct->LIN_Pu30K_Enable;
}

void LIN_Cmd(LINPORT_TypeDef* LINPORTx, FunctionalState NewState)
{
  if (NewState != DISABLE)
  {
    LINPORTx->CR_b.LINPORTEN = 1;
  }
  else
  {
    LINPORTx->CR_b.LINPORTEN = 0;
  }     
}

void LIN_ITConfig(LINPORT_TypeDef* LINPORTx, uint32_t LIN_IT, FunctionalState NewState)
{
		
}

void LINRX_Cmd(LINPORT_TypeDef* LINPORTx, FunctionalState NewState)
{
  if (NewState != DISABLE)
  {
    LINPORTx->CR_b.RXEN = 1;
  }
  else
  {
    LINPORTx->CR_b.RXEN = 0;
  }     
}
/***************************************END OF FILE*********************************/
